<template>
    <view>
        <!-- d:\applet\byteApplet\dy-wallpaper-applet-2\pages\creator\record\record.ttml -->
		
		<view class="cu-list grid col-4 guoshao-shouyi">
		    <view class="cu-item guoshao-money">
		        <view class="text-red">￥{{ sumMoney }}</view>
		        <text>累计</text>
		    </view>
		    <view class="cu-item guoshao-money">
		        <view class="text-red">￥{{ lastMonth }}</view>
		        <text>上月</text>
		    </view>
			<view class="cu-item guoshao-money">
			    <view class="text-red">￥{{ thisMonth }}</view>
			    <text>本月</text>
			</view>
			<view class="cu-item guoshao-money">
			    <view class="text-red">￥{{ yesterdayMoney }}</view>
			    <text>昨日收益</text>
			</view>
		</view>
		
		<view class="guoshao-tishi">温馨提示：数据同步存在滞后性，实际收入请以结算单为准</view>
		
		
        <view class="cu-list menu sm-border card-menu margin-top">
            <view class="cu-item">
                <view class="content padding-tb-sm">
                    <view class="guoshao-font-weight">
                        <text class="text-blue margin-right-xs"></text>
                        待结算
                    </view>
                    <view class="text-black text-sm">
                        <text class="margin-right-xs"></text>
                        抖音均为次日结算前日ECPM价格
                    </view>
                </view>
            </view>
            <view class="cu-item" @click.stop.prevent="" data-link="../../creator/adprofit/adprofit" data-status="1">
                <view class="content padding-tb-sm">
                    <text class="text-black"></text>
                    <text class="text-black">下载次数</text>
                </view>
                <view class="action">
                    <text class="text-red text-sm">{{ count }}</text>
                </view>
            </view>
			<view class="cu-item" @click.stop.prevent="" data-link="../../creator/adprofit/adprofit" data-status="1">
			    <view class="content padding-tb-sm">
			        <text class="text-black"></text>
			        <text class="text-black">奖励次数</text>
			    </view>
			    <view class="action">
			        <text class="text-red text-sm">{{ rewardCount }}</text>
			    </view>
			</view>
        </view>

        <view class="cu-list menu sm-border card-menu margin-top">
            <view class="cu-item">
                <view class="content padding-tb-sm">
                    <view class="guoshao-font-weight">
                        <text class="text-blue margin-right-xs"></text>
                        已结算
                    </view>
                    <!--
            <view class="text-black text-sm">
                <text class="margin-right-xs"></text> 2021-09-05至2021-10-15
            </view>
            -->
                </view>
            </view>
            <view class="cu-item arrow" @click.stop.prevent="jumpClick" data-link="../../creator/adprofit/adprofit" data-status="2" data-dtype="1">
                <view class="content padding-tb-sm">
                    <text class="text-black"></text>
                    <text class="text-black">广告</text>
                </view>
                <view class="action">
                    <text class="text-red text-sm">￥{{ toSettled }}</text>
                </view>
            </view>
			<view class="cu-item arrow" @click.stop.prevent="jumpClick" data-link="../../creator/adprofit/adprofit" data-status="2" data-dtype="2">
			    <view class="content padding-tb-sm">
			        <text class="text-black"></text>
			        <text class="text-black">奖励</text>
			    </view>
			    <view class="action">
			        <text class="text-red text-sm">￥{{ rewardSett }}</text>
			    </view>
			</view>
        </view>

        <view class="cu-list menu sm-border card-menu margin-top">
            <view class="cu-item">
                <view class="content padding-tb-sm">
                    <view class="guoshao-font-weight">
                        <text class="text-blue margin-right-xs"></text>
                        已打款
                    </view>
                </view>
            </view>
            <view class="cu-item arrow" @click.stop.prevent="jumpClick" data-link="../../creator/adprofit/adprofit" data-status="3" data-dtype="1">
                <view class="content padding-tb-sm">
                    <text class="text-black"></text>
                    <text class="text-black">广告</text>
                </view>
                <view class="action">
                    <text class="text-red text-sm">￥{{ paid }}</text>
                </view>
            </view>
			<view class="cu-item arrow" @click.stop.prevent="jumpClick" data-link="../../creator/adprofit/adprofit" data-status="3" data-dtype="2">
			    <view class="content padding-tb-sm">
			        <text class="text-black"></text>
			        <text class="text-black">奖励</text>
			    </view>
			    <view class="action">
			        <text class="text-red text-sm">￥{{ rewardPay }}</text>
			    </view>
			</view>
        </view>
    </view>
</template>

<script>
// d:\applet\byteApplet\dy-wallpaper-applet-2\pages\creator\record\record.js

const http = require('../../../utils/http.js');

export default {
    data() {
        return {
            settled: 0,
            toSettled: 0, //广告已结算
            paid: 0,  //广告已打款
            count: 0, //下载次数
			rewardCount:0,//奖励次数
			rewardSett:0,//奖励 已结算
			rewardPay:0 ,//奖励已打款
			sumMoney:0, //总收益
			yesterdayMoney:0, //昨日收益
			lastMonth:0, //上月收益
			thisMonth:0,//本月收益
        };
    },
    onLoad: function (options) {
        this.loadProfit();
    },
    methods: {
        jumpClick: function (e) {
            let link = e.currentTarget.dataset.link;
            let status = e.currentTarget.dataset.status;
			let dtype = e.currentTarget.dataset.dtype;
            link = link + '?status=' + status + "&dtype="+dtype;
            console.log(e);
            uni.navigateTo({
                url: link,
                // 指定页面的 url
                success: (res) => {},
                fail: (res) => {
                    console.log(res);
                }
            });
        },

        loadProfit: function () {
            let that = this;
            var params = {
                url: '/p/balance/profit',
                method: 'GET',
                data: {
                },
                callBack: function (res) {
                    that.setData({
                        //settled: res.data.settled,
                        toSettled: res.data.toSettled,
                        paid: res.data.paid,
                        count: res.data.count,
						rewardCount:res.data.rewardCount,
						rewardSett:res.data.rewardSett,
						rewardPay:res.data.rewardPay,
						sumMoney:res.data.sumMoney,
						yesterdayMoney:res.data.yesterdayMoney,
						lastMonth:res.data.lastMonth,
						thisMonth:res.data.thisMonth
                    });
                }
            };
            http.request(params);
        }
    }
};
</script>
<style>
@import './record.css';
</style>
